package httpserver

import (
	"fmt"
	"strconv"
	"github.com/devfeel/dotweb"
	"github.com/devfeel/dotweb/framework/file"
)

func StartServer() error {

	app := dotweb.New()
	//设置dotserver日志目录

	app.SetLogPath(file.GetCurrentDirectory()+"/logs/")

	//设置gzip开关
	app.HttpServer.SetEnabledGzip(true)

	//设置路由
	InitRoute(app.HttpServer)
	// 开始服务
	port := 8081
	fmt.Println("dotweb.StartServer => " + strconv.Itoa(port))
	err := app.StartServer(port)
	fmt.Println("dotweb.StartServer error => ", err)
	return err
}
